clear;
clc;

cd 'dir'
%%-------------------------------------------------------------------------
%%Part 1: Regressions (Re-weighted)
%%-------------------------------------------------------------------------

%%Plot: Compare Auto Prod Percentage Drop vs Proxy Percentage Drop
clear

load reg_input.txt
na_exp = reg_input(16:29,3)./1000000;
na_exp_perc = na_exp(:,1)./3.50489425;

load auto_data.txt
auto_perc = auto_data(7:20,2);

time = [-4:1:9]';
zeroline = zeros(length(time),1);

figure(1)
handlevector(1)=plot(time, na_exp_perc,'k','LineWidth',2);
hold on;
handlevector(2)=plot(time,auto_perc,'Color',[0 0 0]+.4,'LineStyle','--','LineWidth',2);
grid on;
AX=legend(handlevector([1 2]),...
{'Output Proxy (NA Exports)','Auto Output'}, 'Location','SouthEast');
LEG = findobj(AX,'type','text');
xlim([-4 9])
set(LEG,'FontSize',12) 
set(gca,'XTick',[-4 -2 0 2 4 6 8 ]);
set(gca,'XTickLabel',[-4 -2 0 2 4 6 8]);
xlabel('Months Relative to Earthquake');
ylabel('Fraction of Pre-Shock Level')
print(figure(1), '-dpng','-r600','prod_perc_compare_new.png');

